package com.sztle.admodule.control.input;

import androidx.annotation.Keep;

import java.util.ArrayList;
import java.util.List;

@Keep
public class SzInRiskDeviceParam {

//    {
//        "deviceId":"6666ddd3",//客户端生成的设备唯一id
//            "pkg":"com.flash.light.dt",//包名
//            "version":"V1.0", //版本
//            "brand":"oppo",//厂商
//            "model":"anl100",//机型
//            "androidid":"12322", //安卓id
//            "osversion":"12",//安卓版本
//            "oaid":"123123123232aass",//oaid
//            "simStatus":"1",//sim卡状态0-正常,1-异常,null无状态
//            "volumeStatus":"1",//音量状态0-正常,1-异常,null无状态
//            "chargeStatus":"1",//充电状态0-正常,1-异常,null无状态
//            "brightnessStatus":"1",//亮度状态0-正常,1-异常,null无状态
//            "developerStatus":"1",// 开发者模式状态0-正常,1-异常,null无状态
//            "usbStatus":"1",// usb状态0-正常,1-异常,null无状态
//            "rootStatus":"1",// root状态0-正常,1-异常,null无状态
//            "electricityStatus":"1",// 电量状态0-正常,1-异常,null无状态
//            "gyroscopeStatus":"1",// 重量感应装置状态0-正常,1-异常,null无状态
//            "vpnStatus":"1",// vpn状态0-正常,1-异常,null无状态
//            "proxyStatus":"0",// 代理状态0-正常,1-异常,null无状态
//            "clStatus":"0",// 常量状态0-正常,1-异常,null无状态
//            "emulatorStatus":"1",//虚拟机状态0-正常,1-异常,null无状态
//            "appList":[//手机应用列表-无权限可不传
//        {"pkg":"com.gov.cn","name":"国务院" }, {"pkg":"com.jingqi.lemontool","name":"应用2" }
//    ]
//
//    }

    public String deviceId;//uuid
    public String pkg;//本app包名
    public String version;//本app 版本
    public String ssoaid;//oaid散列16位

    //非必填
    public String brand;//厂商
    public String model;//机型
    public String osversion;//Android系统版本
    public String androidid;//android id
    public String oaid;//

    public String simStatus = "0";;//sim卡状态0-正常,1-异常,null无状态
    public String volumeStatus = "0";;//音量状态0-正常,1-异常,null无状态,0-100正常
    public String chargeStatus = "0";;//充电状态0-正常,1-异常,null无状态

    public String developerStatus = "0";;//开发者模式状态0-正常,1-异常,null无状态
    public String usbStatus = "0";;//usb状态0-正常,1-异常,null无状态
    public String rootStatus = "0";;// root状态0-正常,1-异常,null无状态
    public String electricityStatus = "0";;//电量状态0-正常,1-异常,null无状态
    public String gyroscopeStatus = "0";;//重量感应装置状态0-正常,1-异常,null无状态
    public String vpnStatus = "0";;//vpn状态0-正常,1-异常,null无状态
    public String proxyStatus = "0";;//代理状态0-正常,1-异常,null无状态
    public String brightnessStatus = "0";;//亮度状态0-正常,1-异常,null无状态
    public String clStatus = "0";;//常亮状态 0-正常,1-异常,null无状态
    public String emulatorStatus = "0";;//虚拟机状态0-正常,1-异常,null无状态

    public String privacyAgreementOpenStatus = "0";
    public String privacyAgreementBottomStatus = "0";

    public String screenRecordingStatus = "0";

    public String bluetoothStatus = "0";
    public List<String> appList = new ArrayList<>();//appList

    public boolean getFirstLocalRiskResult(){
        boolean result = (rootStatus.equalsIgnoreCase("1") || proxyStatus.equalsIgnoreCase("1")
                || emulatorStatus.equalsIgnoreCase("1")
                || privacyAgreementOpenStatus.equalsIgnoreCase("1"));
        return result;
    }
    public int getSecondLocalRiskCount(){
        int count = 0;
        if(developerStatus.equalsIgnoreCase("1")){
            count += 1;
        }
        if(simStatus.equalsIgnoreCase("1")){
            count += 1;
        }
        if(vpnStatus.equalsIgnoreCase("1")){
            count += 1;
        }
        if(usbStatus.equalsIgnoreCase("1")){
            count += 1;
        }
        if(clStatus.equalsIgnoreCase("1")){
            count += 1;
        }
        return count;
    }
    public List<String> getInRiskKey() {
        List<String> riskList = new ArrayList<>();
        if (brightnessStatus.equalsIgnoreCase("1")) {
            riskList.add("brightness");
        }
        if (chargeStatus.equalsIgnoreCase("1")) {
            riskList.add("charge");
        }
        if (clStatus.equalsIgnoreCase("1")) {
            riskList.add("cl");
        }
        if (developerStatus.equalsIgnoreCase("1")) {
            riskList.add("developer");
        }
        if (electricityStatus.equalsIgnoreCase("1")) {
            riskList.add("electricity");
        }
        if (emulatorStatus.equalsIgnoreCase("1")) {
            riskList.add("emulator");
        }
        if (gyroscopeStatus.equalsIgnoreCase("1")) {
            riskList.add("gyroscope");
        }
        if (privacyAgreementBottomStatus.equalsIgnoreCase("1")) {
            riskList.add("privacy_agreement_bottom");
        }
        if (privacyAgreementOpenStatus.equalsIgnoreCase("1")) {
            riskList.add("privacy_agreement_open");
        }
        if (proxyStatus.equalsIgnoreCase("1")) {
            riskList.add("proxy");
        }
        if (rootStatus.equalsIgnoreCase("1")) {
            riskList.add("root");
        }
        if (simStatus.equalsIgnoreCase("1")) {
            riskList.add("sim");
        }
        if (usbStatus.equalsIgnoreCase("1")) {
            riskList.add("usb");
        }
        if (volumeStatus.equalsIgnoreCase("1")) {
            riskList.add("volume");
        }
        if (vpnStatus.equalsIgnoreCase("1")) {
            riskList.add("vpn");
        }
        return riskList;
    }

    @Override
    public String toString() {
        return "SzInRiskDeviceParam{" +
                "simStatus='" + simStatus + '\'' +
                ", volumeStatus='" + volumeStatus + '\'' +
                ", chargeStatus='" + chargeStatus + '\'' +
                ", brightnessStatus='" + brightnessStatus + '\'' +
                ", developerStatus='" + developerStatus + '\'' +
                ", usbStatus='" + usbStatus + '\'' +
                ", rootStatus='" + rootStatus + '\'' +
                ", electricityStatus='" + electricityStatus + '\'' +
                ", gyroscopeStatus='" + gyroscopeStatus + '\'' +
                ", vpnStatus='" + vpnStatus + '\'' +
                ", proxyStatus='" + proxyStatus + '\'' +
                ", clStatus='" + clStatus + '\'' +
                ", emulatorStatus='" + emulatorStatus + '\'' +
                ", appList=" + appList +
                ", deviceId='" + deviceId + '\'' +
                ", pkg='" + pkg + '\'' +
                ", version='" + version + '\'' +
                ", ssoaid='" + ssoaid + '\'' +
                ", brand='" + brand + '\'' +
                ", model='" + model + '\'' +
                ", osversion='" + osversion + '\'' +
                ", androidid='" + androidid + '\'' +
                ", oaid='" + oaid + '\'' +
                '}';
    }
}
